//
//  ViewController.m
//  RSChooseCityPickerView
//
//  Created by thinkjoy on 16/9/9.
//  Copyright © 2016年 Thinkjoy_RS. All rights reserved.
//

#import "ViewController.h"
#import "ChooseCity1/ChooseCityCase.h"
#import "ChooseCity2/RSChooseCityPickerView.h"
#import "chooseCity3/RSChooseCityPickViewTwo.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *labOne;
@property (weak, nonatomic) IBOutlet UILabel *labTwo;
@property (weak, nonatomic) IBOutlet UILabel *labThree;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

}
- (IBAction)clickButtOne:(UIButton *)sender
{
    ChooseCityCase *cityCase    =   [[ChooseCityCase alloc]initWithProvinceRow:0 withCityRow:0];
    [cityCase setChooseCityViewBlock:^(NSDictionary * dic) {
        NSLog(@"%@",dic);
    }];
}
- (IBAction)clickButtTwo:(UIButton *)sender
{
    RSChooseCityPickerView  * cityPickerView    =   [RSChooseCityPickerView shareInstance];
    [cityPickerView showBottomView];
    [self.view   addSubview:cityPickerView];
    [cityPickerView setBlock:^(NSString *province, NSString *city, NSString *district){
        NSLog(@"%@--%@--%@",province,city,district);
        self.labTwo.text    =   [NSString stringWithFormat:@"%@-%@-%@",province,city,district];
    }];

}
- (IBAction)clickbuttThree:(UIButton *)sender
{
    RSChooseCityPickViewTwo * chooseCityCase =   [[RSChooseCityPickViewTwo alloc]initWithTitle:@"请选择目的地"];
    //        @{@"Province":_currentProvince,
    //          @"City":_currentCity,
    //          @"District":_currentDistrict}
    [chooseCityCase setChooseCityViewBlock:^(NSDictionary * infoDic) {
        NSLog(@"%@",infoDic);
        NSMutableString * startAds =   [NSMutableString stringWithString:infoDic[@"Province"]];
        if (infoDic[@"City"]) {
            [startAds appendString:infoDic[@"City"]];
        }
        if (infoDic[@"District"]) {
            [startAds appendString:infoDic[@"District"]];
        }
        
        self.labThree.text   =   startAds;
        
    }];

}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
